package birdsong.Spam;

import java.util.LinkedList;

import birdsong.comm.ServerComm;
import birdsong.comm.ServerSideMessage;

public class TestServerComm implements ServerComm {

	private LinkedList<ServerSideMessage> listOfMessages = new LinkedList<ServerSideMessage>();
	private LinkedList<Integer> delay = new LinkedList<Integer>();
	
	public TestServerComm(LinkedList<ServerSideMessage> listOfMessages, LinkedList<Integer> delay){
		this.delay = delay;
		this.listOfMessages = listOfMessages;
	}
	
	
	@Override
	public void start() {
		// TODO Auto-generated method stub	
	}

	@Override
	public ServerSideMessage getNextMessage() {
		try{
			Thread.sleep(delay.poll().intValue());
			return listOfMessages.poll();
			}catch( Exception e ){  
				System.out.println("Without any Messages");  
			}
			return null;
	}

	@Override
	public boolean hasNextMessage() {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public void sendBirdsongMessage(String fromNicename, String toNickname,
			String birdsongMessage) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void sendNewFollower(String toNickname, String newFollower) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void sendNewUnfollow(String toNickname, String unfollower) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void sendError(String toNickname, String error) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void sendClientConnected(String toNickname, String connectedNickname) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void sendClientDisconnected(String toNickname,
			String disconnectedNickname) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public boolean clientIsConnected(String nickname) {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public void disconnectClient(String nickname) {
		// TODO Auto-generated method stub
		
	}

}
